package com.mo.ld.activity.interactive

import androidx.lifecycle.ViewModel
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mo.ld.bean.ActionBean
import com.mo.ld.modle.getMainAdapter2
import com.mo.lib.ui.activity.BaseRvActivity
import com.mo.lib.utils.createViewModel
import com.mo.lib.utils.showToast

/**
 * @ author：mo
 * @ data：2022/4/26:9:33
 * @ 功能：ViewModel相关
 */
class ViewModelActivity : BaseRvActivity<ActionBean>() {
    val viewModel by lazy {
        createViewModel<TViewModel>()
    }
    override fun initData() {
//        viewModel=createViewModel()
    }

    override fun creatAdaper(): BaseQuickAdapter<ActionBean, BaseViewHolder> {
        return getMainAdapter2(mutableListOf(ActionBean("测试调用") {
            viewModel.toTost()
        }))
    }

    override fun getList(page: Int) {
    }

    override fun getMore(page: Int) {
    }
}

class TViewModel() : ViewModel() {
    fun toTost() {
        showToast("ddddddddd")
    }
}
